function error_handler(err)
    local info = debug.getinfo(2, "Sl")
    local location = info.short_src .. ":" .. info.currentline
    print("Error at " .. location .. ": " .. err)
    print("========================")
end

-- 将该错误处理函数设置为全局错误处理器
-- debug.traceback = error_handler
_G.error = error_handler;
function foo()
    return a + 1
end

function bar()
    foo()
end

bar()